Programming Assignment 2
Implement and Test the List Class Using a Fixed-Sized Array

Assigned October 11, 2003
Due: October 18, 2003


The Assignment:
You will implement and test the List class using an array to store the List's items.
Purposes:
Ensure that you can write a small class that uses an array as a private member variable.
Familiarize yourself with the List container class (which may also be part of future assignments).
Give us a chance to evaluate your programming skills on a small class.
 
Files that you must write:
  1. list1.h: The header file for the List class. Actually, you don't have to write much of this file. Just start with the version provided and add your name and other information at the top. Also, decide on appropriate private member variables, an declare these in the List class definition at the bottom o the header file If some of your member functions are implemented as inline functions, then you may put those implementations in this file too.
  2. list1.cpp: The implementation file for this first List class. You will write all of this file, which will have the implementations of all the List's member functions.

 

Other files that you may find helpful:
  1. listtest.cpp: A simple interactive test program.
  2. listexam.cpp: A non-interactive test program that will be used to grade the correctness of your List class.

The List Class Using a Fixed-Sized Array
Discussion of the Assignment

Use of a fixed array is the first implementation of the List ADT discussed in the lectures. Such an implementation has the limitation on the number of elements that can be stored in the List.

As always, do your work in small pieces. For example, your first version of the List could have only a constructor, start, insert, advance, and current. Other member functions can be stubs.

Use the interactive test program and the debugger to track down errors in your implementation. If you have an error, do not start making changes until you have identified the cause of the error.


Important Note: How to submit your assignment